<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="jquery-3.4.1.js"></script>
    <style>
        * {
            margin: 0;
            padding: 0;
        }
        ul{
            list-style: none;
        }
        .nav{
            margin: 0 auto;
            background-color: black;
            width: 900px;
            height: 60px;
        }
        .nav li{
            float: left;
            position: relative;
            width: 100px;
            height: 60px;
            overflow: hidden;
        }
        .nav a{
            position: absolute;
            width: 100%;
            height: 100%;
            font-size: 24px;
            color: blue;
            line-height: 60px;
            text-align: center;
            text-decoration: none;
            z-index: 1;
        }
        .nav span{
            position: absolute;
            width: 100%;
            height: 100%;
            background-color: yellow;
            top: 60px;
        }
    </style>
    <script>
        $(function () {
            $(".nav li").mouseenter(function () {
                $(this).children("span").stop().animate({top:0});
                let index=$(this).index();
                $(".nav audio").get(index).load();
                $(".nav audio").get(index).play();
            }).mouseleave(function () {
                $(this).children("span").stop().animate({top:60});
            });
            let flag=true;
            $(document).on("keydown",function (e) {
                if(flag){
                    flag=false;
                    let code=e.keyCode;
                    if(code>=49&&code<=57){
                        $(".nav li").eq(code-49).mouseenter();
                    }
                }
            });
            $(document).on("Keyup",function (e) {
                    flag=true;
                    let code=e.keyCode;
                    if(code>=49&&code<=57){
                        $(".nav li").eq(code-49).mouseleave();
                    }
            });
        })
    </script>
</head>
<body>
<div class="nav">
    <ul>
        <li><a href="#">导航1</a><span></span></li>
        <li><a href="#">导航2</a><span></span></li>
        <li><a href="#">导航3</a><span></span></li>
        <li><a href="#">导航4</a><span></span></li>
        <li><a href="#">导航5</a><span></span></li>
        <li><a href="#">导航6</a><span></span></li>
        <li><a href="#">导航7</a><span></span></li>
        <li><a href="#">导航8</a><span></span></li>
        <li><a href="#">导航9</a><span></span></li>
    </ul>
    <div>
        <audio src="mp3/1.ogg"></audio>
        <audio src="mp3/2.ogg"></audio>
        <audio src="mp3/3.ogg"></audio>
        <audio src="mp3/4.ogg"></audio>
        <audio src="mp3/5.ogg"></audio>
        <audio src="mp3/6.ogg"></audio>
        <audio src="mp3/7.ogg"></audio>
        <audio src="mp3/8.ogg"></audio>
        <audio src="mp3/9.ogg"></audio>
    </div>
</div>
</body>
</html>